Thanks TK. I absolutely LOVE the flexibility and possibilities your board provides, but sadly it means getting it up and running the first time isn't so easy for n00bs like me. :-(
Unfortunately adding the EnableAxisDest commands didn't change anything. Actually, that's not true.... I originally had EnableAxis in there but took it out when I realized it was screwing up my machine coordinates when I zeroed an axis at an arbitrary point. EnableAxisDest doesn't seem to do that, so that's progress. :-)
I don't see a way to attach files to this post, so I'll email the XML file to support@dyno....
Thanks!
-aric.
--- In
DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hmmm sounds like you are doing everything correctly. The only
thing I can see is that you are not enabling the KFLOP axis channels in the Init.c program. Add the code below toward the end of the Init. Mach3 must be out of Reset for it to do homing. The axes need to be enabled in Mach3 also. If you continue to have problems send my your Mach3 XML file.
> Â
> Â
> Â EnableAxisDest(0,0);
> Â EnableAxisDest(1,0);
> Â EnableAxisDest(2,0);
>
> Â
> Â
> TK
> Â
> From: adatesman <adatesman@...>
> To:
DynoMotion@yahoogroups.com> Sent: Tuesday, August 30, 2011 8:31 AM
> Subject: [DynoMotion] Re: Need help with Step/Dir homing in Mach3
>
>
> Â
> Thanks for the
speedy reply, TK!
>
> Yup, my program was folded into the HomeMach3.c program and when I edit a flags assignment into the program manually (i.e. "flags=1;" to home X) and then run it in the C Program window it will home that axis properly.
>
> Poking around some more I saved off copies of my files and reinstalled both KMotion and Mach3 to make sure I had clean copies of everything before watching the console. With the Plugin set to use my modified init program, the default HomeMach3.c and the default NotifyMach3.c the Console will pop up a message saying "Mach3 Notify Message=4, Direction= 0, Spindle Set to 0.000000
> Spindle Stop" when the Reset button is pushed but nothing when any of the Ref buttons are pushed.
>
> So it seems to me I have a disconnect somewhere between either Mach3 and the Plugin or the Plugin and KFLOP. Any thoughts on where to look?
>
> Thanks for helping out the
clueless... :-)
> -aric.
>
> BTW, For reference, here are my current HomeMach3.c, NotifyMach3.c and init.c (ignore the title blocks, there's only here to make things more readable). The Plugin is set to use each of these in the appropriate boxes and have the same Thread number as noted in the headers below:
>
> -----------
> HomeMach3.c, set as Thread 4 on the C Programs window
> -----------
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 Home (actually Purge) Commands
>
> main()
> {
> int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
>
> printf("Mach3 Home Call, flags = %d\n",flags);
>
> if (flags==1)
> {
> // do x homing here
> }
>
> if (flags==2)
> {
> // do y homing here
> }
>
> if (flags==4)
> {
> // do z homing here
>
}
>
>
> printf("Done\n");
> }
>
> -------------
> NotifyMach3.c, set as Thread 5 in the C Programs window
> -------------
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 NotifyPlugins Commands
>
> main()
> {
> int msg = persist.UserData[6]; // Mach3 notify Message 10000-10999
>
> printf("Mach3 Notify Call, Message = %d\n",msg);
>
> Delay_sec(2.0);
>
> printf("Done\n");
> }
>
> --------------------
> myInitStepDir4axis.c, set as Thread 1 in the C Programs window
> --------------------
> #include "KMotionDef.h"
>
> main()
> #define X 0
> #define Y 1
> #define Z 2
>
> {
> DefineCoordSystem(0,1,2,-1);
> FPGA(STEP_PULSE_LENGTH_ADD)=32 + 0x80;
>
> ch0->InputMode=NO_INPUT_MODE;
>
ch0->OutputMode=STEP_DIR_MODE;
> ch0->Vel=275000;
> ch0->Accel=1250000;
> ch0->Jerk=50000000;
> ch0->P=1;
> ch0->I=0;
> ch0->D=0;
> ch0->FFAccel=0;
> ch0->FFVel=0;
> ch0->MaxI=200;
> ch0->MaxErr=1000000;
> ch0->MaxOutput=200;
> ch0->DeadBandGain=1;
> ch0->DeadBandRange=0;
> ch0->InputChan0=0;
> ch0->InputChan1=0;
> ch0->OutputChan0=24;
> ch0->OutputChan1=0;
> ch0->MasterAxis=-1;
> ch0->LimitSwitchOptions=0x10;
> ch0->InputGain0=1;
> ch0->InputGain1=1;
> ch0->InputOffset0=0;
> ch0->InputOffset1=0;
> ch0->OutputGain=1;
> ch0->OutputOffset=0;
> ch0->SlaveGain=1;
> ch0->BacklashMode=BACKLASH_OFF;
> ch0->BacklashAmount=0;
> ch0->BacklashRate=0;
> ch0->invDistPerCycle=1;
>
ch0->Lead=0;
> ch0->MaxFollowingError=1000000000;
> ch0->StepperAmplitude=250;
>
> ch0->iir[0].B0=1;
> ch0->iir[0].B1=0;
> ch0->iir[0].B2=0;
> ch0->iir[0].A1=0;
> ch0->iir[0].A2=0;
>
> ch0->iir[1].B0=1;
> ch0->iir[1].B1=0;
> ch0->iir[1].B2=0;
> ch0->iir[1].A1=0;
> ch0->iir[1].A2=0;
>
> ch0->iir[2].B0=0.0007689999765716;
> ch0->iir[2].B1=0.001537999953143;
> ch0->iir[2].B2=0.0007689999765716;
> ch0->iir[2].A1=1.920809984207;
> ch0->iir[2].A2=-0.9238849878311;
>
> ch1->InputMode=NO_INPUT_MODE;
> ch1->OutputMode=STEP_DIR_MODE;
> ch1->Vel=275000;
> ch1->Accel=1000000;
> ch1->Jerk=50000000;
> ch1->P=1;
> ch1->I=0;
> ch1->D=0;
> ch1->FFAccel=0;
> ch1->FFVel=0;
>
ch1->MaxI=200;
> ch1->MaxErr=1000000;
> ch1->MaxOutput=200;
> ch1->DeadBandGain=1;
> ch1->DeadBandRange=0;
> ch1->InputChan0=1;
> ch1->InputChan1=2;
> ch1->OutputChan0=25;
> ch1->OutputChan1=3;
> ch1->MasterAxis=-1;
> ch1->LimitSwitchOptions=0x10010;
> ch1->InputGain0=1;
> ch1->InputGain1=1;
> ch1->InputOffset0=0;
> ch1->InputOffset1=0;
> ch1->OutputGain=1;
> ch1->OutputOffset=0;
> ch1->SlaveGain=1;
> ch1->BacklashMode=BACKLASH_OFF;
> ch1->BacklashAmount=0;
> ch1->BacklashRate=0;
> ch1->invDistPerCycle=1;
> ch1->Lead=0;
> ch1->MaxFollowingError=1000000000;
> ch1->StepperAmplitude=250;
>
> ch1->iir[0].B0=1;
> ch1->iir[0].B1=0;
> ch1->iir[0].B2=0;
> ch1->iir[0].A1=0;
>
ch1->iir[0].A2=0;
>
> ch1->iir[1].B0=1;
> ch1->iir[1].B1=0;
> ch1->iir[1].B2=0;
> ch1->iir[1].A1=0;
> ch1->iir[1].A2=0;
>
> ch1->iir[2].B0=1;
> ch1->iir[2].B1=0;
> ch1->iir[2].B2=0;
> ch1->iir[2].A1=0;
> ch1->iir[2].A2=0;
>
> ch2->InputMode=NO_INPUT_MODE;
> ch2->OutputMode=STEP_DIR_MODE;
> ch2->Vel=275000;
> ch2->Accel=1000000;
> ch2->Jerk=50000000;
> ch2->P=1;
> ch2->I=0;
> ch2->D=0;
> ch2->FFAccel=0;
> ch2->FFVel=0;
> ch2->MaxI=200;
> ch2->MaxErr=1000000;
> ch2->MaxOutput=200;
> ch2->DeadBandGain=1;
> ch2->DeadBandRange=0;
> ch2->InputChan0=2;
> ch2->InputChan1=3;
> ch2->OutputChan0=26;
> ch2->OutputChan1=5;
> ch2->MasterAxis=-1;
>
ch2->LimitSwitchOptions=0x10;
> ch2->InputGain0=1;
> ch2->InputGain1=1;
> ch2->InputOffset0=0;
> ch2->InputOffset1=0;
> ch2->OutputGain=1;
> ch2->OutputOffset=0;
> ch2->SlaveGain=1;
> ch2->BacklashMode=BACKLASH_OFF;
> ch2->BacklashAmount=0;
> ch2->BacklashRate=0;
> ch2->invDistPerCycle=1;
> ch2->Lead=0;
> ch2->MaxFollowingError=1000000000;
> ch2->StepperAmplitude=250;
>
> ch2->iir[0].B0=1;
> ch2->iir[0].B1=0;
> ch2->iir[0].B2=0;
> ch2->iir[0].A1=0;
> ch2->iir[0].A2=0;
>
> ch2->iir[1].B0=1;
> ch2->iir[1].B1=0;
> ch2->iir[1].B2=0;
> ch2->iir[1].A1=0;
> ch2->iir[1].A2=0;
>
> ch2->iir[2].B0=1;
> ch2->iir[2].B1=0;
> ch2->iir[2].B2=0;
> ch2->iir[2].A1=0;
>
ch2->iir[2].A2=0;
>
> }
>
> --- In
DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> >
> >
> >
> >
> >
> > Hi Aric,
> > ÂÂ
> > Actually the Mach3 Ref buttons should not normally need to be changed. The default screen codes should cause Mach3 to send Homing requests to the plugin.
> > ÂÂ
> > The plugin passes the Homing Request to the defined KFLOP C Homing program - not the Notification program.ÂÂ
> > ÂÂ
> > So I understand you do have C code that you tested using the C Programs Screen that will home your axes properly? Is that one at a time or all of
them together? ÂÂ
> > ÂÂ
> > You will need to merge that C code into the C program that you configure Mach3 to call for Homing. Start with the HomeMach3.c example. Mach3 generates different Home messages for each axis it wants to be homed. It sends a "flags" value that indicates which axis it wishes to be homed. These messages will all invoke the same HomeMach3.c program so the Home program must check the flags value and only execute code to home the appropriate axis. Before you merge any of your code into the HomeMach3.c program, the program will simply print the flags variable to the Console Screen. So you may want to test that the appropriate value is printed when pushing the Mach3 Ref buttons so you know that the screens, Mach3, and plugin are doing their parts correctly.
> >
ÂÂ
> > HTH
> > TKÂÂ
> >
> > --- On Mon, 8/29/11, adatesman <adatesman@> wrote:
> >
> >
> > From: adatesman <adatesman@>
> > Subject: [DynoMotion] Need help with Step/Dir homing in Mach3
> > To:
DynoMotion@yahoogroups.com> > Date: Monday, August 29, 2011, 5:29 PM
> >
> >
> > ÂÂ
> >
> >
> >
> > Howdy,
> >
> > After much searching, I've finally understand how open loop Step/Dir homing works and have it working on my machine when run in the C Program screen in KMotion. Unfortunately I'm completely lost on getting it to work in Mach3, even after going through the closed loop
example on the Dynomotion site.
> >
> > Near as I can tell I need to do 3 things:
> > 1. Reconfigure the Ref X, Y and Z buttons on my Mach screen to execute OEM-Code 1022, 1023 and 1024 respectively (per the closed loop example)
> >
> > 2. Set up my Notification program in the Plugin to point to the correct program with the correct thread number and variable code
> >
> > Both seem easy enough to do, which is why I'm suspecting I'm missing something given that it doesn't work. My guess is it's my Notification program, which is just the basic NotifyMach3.c example given with the install. I take it there's changes needed there as well?
> >
> > Thanks,
> > -aric.
> >
>